package com.ruoyi;

import com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, PageHelperAutoConfiguration.class})
@MapperScan("com.ruoyi.*.mapper")
@Slf4j
public class RuoYiApplication {
    public static void main(String[] args) throws UnknownHostException {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
        ConfigurableEnvironment env = application.getEnvironment();
        String host = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        System.out.println("(♥◠‿◠)ﾉﾞ  考研陪伴系统启动成功   ლ(´ڡ`ლ)ﾞ  \n" +

                " ——                                           \n" +
                "| |                                           \n" +
                "| | ____ _  ___        _   _  __ _ _ __       \n" +
                "| |/ / _` |/ _ \\     | | | |/ _`  | '_ \\    \n" +
                "|   < (_| | (_) ||   |_| | | (_|  | | | |     \n" +
                "|_|\\_\\__,_|\\___/     \\__, |\\__,_|_| |_|  \n" +
                "                      __/ |                   \n" +
                "                     |___/                    \n"
        );
        log.info("\n----------------------------------------------------------\n\t" +
                        "Application '{}' is running! Access URLs:\n\t" +
                        "Local: \t\thttp://localhost:{}\n\t" +
                        "External: \thttp://{}:{}\n\t" +
                        "Doc: \t\thttp://{}:{}/doc.html\n\t" +
                        "Swagger: \thttp://{}:{}/swagger-ui.html\n\t" +
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                env.getProperty("server.port"),
                host, port,
                host, port,
                host, port);
    }
}
